<?php
class AddressCheck extends Check {

    public function addCheck(Model &$model) {
        if(self::checkStrEqual($_POST['name'],2,'min')) {
            $this->flag = false;
            $this->message[] = '收货人姓名不能少于两位!';
        }
        if(self::checkStrEqual($_POST['name'],20,'max')) {
            $this->flag = false;
            $this->message[] = '收货人姓名不能大于二十位!';
        }
        if(self::checkStrEqual($_POST['address'],100,'max')) {
            $this->flag = false;
            $this->message[] = '收货人地址不能大于一百位!';
        }
        if(self::checkStrEqual($_POST['email'],2,'max')) {
            $this->flag = false;
            $this->message[] = '电子邮件不能大于一百位!';
        }
        if(!self::checkEmail($_POST['email'])) {
            $this->flag = false;
            $this->message[] = '电子邮件不合法!';
        }
        if(!self::isNumber($_POST['zipcode'])) {
            $this->flag = false;
            $this->message[] = '邮政编码必须为纯数字!';
        }
        if(self::checkStrLength($_POST['zipcode'],6,'equals')) {
            $this->flag = false;
            $this->message[] = '邮政编码必须为五位数字!';
        }
        if(!self::isNumber($_POST['phone'])) {
            $this->flag = false;
            $this->message[] = '手机号码必须为纯数字!';
        }
        if(self::checkStrLength($_POST['phone'],11,'equals')) {
            $this->flag = false;
            $this->message[] = '手机号码必须为十一位数字!';
        }
        if(self::checkStrLength($_POST['building'],100,'max')) {
            $this->flag = false;
            $this->message[] = '标志建筑不能超过一百位!';
        }
        return $this->flag;

    }

}


?>